package com.functest.orm

import com.functest.framework.BaseFunctionalTest
import org.testng.annotations.DataProvider
import org.testng.annotations.Test

/**
 * Created with IntelliJ IDEA.
 * User: KovalevAS
 * Date: 28.08.13
 * Time: 10:39
 */
class MapperUtilTest extends BaseFunctionalTest {

    @DataProvider
    Object[][] intToBoolData(){
        Map mapParams = [:]
        mapParams.put('name', 'name')
        mapParams.put('from', 'name')
        mapParams.put('transform', MapperUtil.transform.intToBool())
        mapParams.put('transformBack', MapperUtil.transformBack.intToBool())
        Field field = new Field(mapParams)

        return [
                [field, [name: 1], true],
                [field, [name: 0], false]
        ]
    }

    @Test(dataProvider = 'intToBoolData')
    void transformIntToBoolTest(Field field, Map map, Boolean expectedValue){
        assert field.transform(field, map) == expectedValue
    }
}
